﻿@model GitCandy.Models.CommitsModel
@using GitCandy.Web.Extensions

@{
    ViewBag.Title = String.Format(SR.Shared_TitleFormat, String.Format(SR.Repository_CommitsTitle, Model.Name ?? Model.Sha.ToShortSha(), Model.Path));
}

<h4>
    @SR.Repository_HistoryFor     @await Html.PartialAsync("_RepositoryLink", Model)
</h4>

@await Html.PartialAsync("_PathBar", Model.PathBar)

@foreach (var commit in Model.Commits)
{
    <div class="border-area">
        <div class="row">
            <div class="col-md-9">
                <div title="@commit.CommitMessageShort">@Html.ActionLink(commit.CommitMessageShort.ShortString(100) ?? "<Unknown>", "Commit", new { path = commit.Sha + "/" + Model.Path })</div>
                <strong title="@commit.Author">@Html.Link(commit.Author)</strong>
                <span>@SR.Repository_AuthoredAt</span>
                <span title="@commit.Author.When">@commit.Author.When.LocalDateTime.ToFullString()</span>
                @if (commit.Author != commit.Committer)
                {
                    <strong title="@commit.Committer">@Html.Link(commit.Committer)</strong>
                    <span>@SR.Repository_CommittedAt</span>
                    <span title="@commit.Committer.When">@commit.Committer.When.LocalDateTime.ToFullString()</span>
                }
            </div>
            <div class="col-md-3">
                <div class="text-right">@Html.ActionLink(commit.Sha.ToShortSha() ?? "<Unknown>", "Commit", new { path = commit.Sha })</div>
                <div class="text-right">@Html.ActionLink(SR.Repository_Tree, "Tree", new { path = commit.Sha })</div>
            </div>
        </div>
    </div>
}
@await Html.PartialAsync("_Pager")
